|
|
|
|
|
|
|
to start your development the right way. If you dont set these options now, it will be necessary to go back into your project and make changes to every form and module you develop. |
|
|
|
|
|
|
|
|
Figure 2.2
The Visual Basic Options dialog box. |
|
|
|
|
|
|
|
|
The Editor tab is where you control items that affect the editing of code. The following sections detail the options you should check to make sure your environment is consistent from application to application. |
|
|
|
|
|
|
|
|
Require Variable Declaration |
|
|
|
|
|
|
|
|
By checking this item, youre specifying that you want all variables to be declared prior to usage in every module/form/class module you create. This is very important in the maintenance and debugging of your code. If this option is not checked, variables may be created on the fly, which means that misspelled variables become a new variable instead of referencing the one you intended. This can be a very hard bug to track down. By checking this option, a statement will be added at the beginning of each of your new modules; Option Explicit. This is what enforces the variable declaration check. |
|
|
|
 |
|
|
|
|
NOTE You can (and will need to) add this statement to any modules you created prior to setting this option. |
|
|
|
|
|